package kr.hyunist.calendarproject.Adapter;

import java.util.ArrayList;

import kr.hyunist.calendarproject.R;
import kr.hyunist.calendarproject.DTO.MyItem;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListCalendarAdapter extends BaseAdapter {
	Context context;
	ArrayList<MyItem> arList; // DB에서 불러와야함. dao에서..
	LayoutInflater inflater;
	TextView viewTitle, viewDate, viewDday;
	int layout;

	public ListCalendarAdapter(Context context, ArrayList<MyItem> arList, int layout) {
		this.context = context;
		this.arList = arList;
		this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		this.layout = layout;
	}

	@Override
	public int getCount() {
		return arList.size();
	}

	@Override
	public Object getItem(int position) {
		return arList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final int pos = position;

		if (convertView == null) {
			convertView = inflater.inflate(R.layout.listcalendarlayout, parent, false);
		}

		viewTitle = (TextView) convertView.findViewById(R.id.listviewtitle);
		viewDate = (TextView) convertView.findViewById(R.id.listviewdate);
		viewDday = (TextView) convertView.findViewById(R.id.listviewdday);

		/*viewTitle.setText(arList.get(position).getTitle());
		viewDate.setText(arList.get(position).getStartDate());	
		viewDday.setText(arList.get(position).getStartTime());*/

		return convertView;
	}

}
